﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Core.PageEntities;
using Core.SupportEntities;
using System.Linq.Expressions;

namespace Core.DBInterfaces
{
    public interface IDbRepository : IDisposable
    {
        IEnumerable<TEntity> Get<TEntity>(Expression<Func<TEntity, bool>> filter = null, string includeProperties = "", Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, int skip = 0,
            int take = 0) where TEntity : class;
        /// <summary>
        /// Set false if you want prevent circular reference
        /// </summary>
        bool IsCreateProxy {get;set;}
        TEntity GetById<TEntity>(object id) where TEntity : class;
        void Insert<TEntity>(TEntity entity) where TEntity : class;
        void Delete<TEntity>(object id) where TEntity : class;
        void Delete<TEntity>(TEntity entityToDelete) where TEntity : class;
        void Update<TEntity>(TEntity entityToUpdate) where TEntity : class;
        int Save();      
    }
}
